package wenjian;

import java.io.*;

public class Test {
    public static void main(String[] args) throws IOException {

        File f=new File("output.txt");
        f.createNewFile();
        FileOutputStream fileOutputStream = new FileOutputStream(f);
       PrintStream printStream = new PrintStream(f);
        System.setOut(printStream);
        Teacher t1 = new Teacher(1, "马老师", '男', "安全生产法规");
        Teacher t2 = new Teacher(2, "李老师", '女', "Java");
        Teacher t3 = new Teacher(3, "王老师", '女', "python");
        Teacher t4 = new Teacher(4, "阎老师", '男', "高等数学");
        Teacher t5=new Teacher(5, "魏老师", '女', "离散数学");

        Course c1 = new Course(13, "101", "周一7:50-9:20", t1);
        Course c2 = new Course(20, "1705", "周二9:40-11：20", t2);
        Course c3 = new Course(21, "102", "周三13:30-15:10", t3);
        Course c4 = new Course(21, "105", "周四13:30-15:10", t4);
        Course c5 = new Course(21, "305", "周一15:30-17:10", t5);

        Student s1 = new Student(1, "Tom", '男', t1, c1,true);
        Student s2 = new Student(1, "Tom", '男', t2, c2,true);
        Student s3 = new Student(1, "Tom", '男', t3, c3,true);
        Student s4 = new Student(1, "Tom", '男', t4, c4,false);
        Student s5 = new Student(1, "Tom", '男', t5, c5,true);

        System.out.println("教师信息:\n" + t1 + "\n" + t2 + "\n" + t3+"\n"+t4+"\n"+t5);
        if (s1.getAll())
            System.out.println("选课成功！\r"+"学生信息:\n" + s1);
        else
            System.out.println("选课失败，请重新操作");
        if (s2.getAll())
            System.out.println("选课成功！\r"+"学生信息:\n" +s2);
        else
            System.out.println("选课失败，请重新操作");
        if (s3.getAll())
            System.out.println("选课成功！\r"+"学生信息:\n" + s3);
        else
            System.out.println("选课失败，请重新操作");
        if (s4.getAll())
            System.out.println("选课成功！\r"+"学生信息:\n" + s4);
        else
            System.out.println("选课失败，请重新操作");
        if (s5.getAll())
            System.out.println("选课成功！\r"+"学生信息:\n" + s5);
        else
            System.out.println("选课失败，请重新操作");

    }
}
